<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>预约信息</title>
    <link href="https://cdn.staticfile.org/twitter-bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet">
    <!-- jQuery文件。务必在bootstrap.min.js 之前引入 -->
    <script src="https://cdn.staticfile.org/jquery/2.1.1/jquery.min.js"></script>
    <!-- 最新的 Bootstrap 核心 JavaScript 文件 -->
    <script src="https://cdn.staticfile.org/twitter-bootstrap/3.3.7/js/bootstrap.min.js"></script>
</head>
<body>
<div class="container" >
    <div><h3 align="center" style="margin-bottom: 40px;">预约信息</h3> </div>
    <table class="table table-striped">
        <thead>
            <tr>
                <th>编号</th>
                <th>姓名</th>
                <th>预约时间</th>
            </tr>
        </thead>

        <tbody>
            <tr th:each="item:${appointInfs}">
                    <td id="id" th:text="${item.getId()}"></td>
                    <td id="name" th:text="${item.getName()}"></td>
                    <td id="work" th:text="${item.getAppointdata()}"></td>
                    <form action="/appointmentinforoutg" method="post" >
                        <td>
                            <input type="text" name="id" class="hidden"/>
                            <button type="submit" class="btn btn-primary"  onclick="find(this)">详情</button>
                        </td>
                    </form>
                   <!-- <a  th:href="'/delete?id='+${appointInfs.id}" class="btn btn-primary">删除</a>-->
                    <form action="/appointdelete" method="post">
                        <td>
                            <input type="text" name="id" class="hidden"/>
                            <!--<a  th:href="'/delete?id='+${doctor.id}" class="btn btn-primary">删除</a>-->
                            <button type="submit" class="btn btn-danger" onclick="find(this)"> 删除</button>
                        </td>
                    </form>

            </tr>
        </tbody>
    </table>   <!-- th:if="${#lists.size(appointinf)<=0}"-->
    <p  style="text-align: center;margin-top: 25%;" th:text="'今日暂无预约!'"></p>
</div>
</body>
<script>
    //实现将当前行id值放入form中
    function find(obj) {
        var id=$(obj).parent().siblings('#id').text();
        $(obj).prev().val(id);
    }

</script>
</html>